package com.rasou.controller;

import com.rasou.feign.DataFeign;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class HelloController {

    private static Logger logger = LoggerFactory.getLogger(HelloController.class);

    final DataFeign dataFeign;

    public HelloController(DataFeign dataFeign) {
        this.dataFeign = dataFeign;
    }


    @GetMapping("/echo")
    public ResponseEntity<String> echo(@RequestParam String msg) {
        logger.info("echo: " + msg);
        return dataFeign.echo(msg);
    }
}
